#include "threadPool.hpp"
#include "Task.hpp"
#include "log.hpp"
// 这是105期，第38节课的
int main()
{
    srand((unsigned long)time(nullptr) ^ getpid());
    ThreadPool<Task> *tp = new ThreadPool<Task>();
    tp->run();
    while (true) // 生产任务
    {
        int x = rand() % 100 + 1;
        usleep(7721);
        int y = rand() % 30 + 1;
        Task t(x, y, [](int x, int y) -> int
               { return x + y; });
        std::cout << "制作任务完成：" << x << "+" << y << "=?" << std::endl;
        tp->pushTask(t);
    }
    return 0;
}